// 时分秒
const formatSeconds = (value: number) => {
  var total_second = value;
  var second: number | string = 0; // 秒
  var min: number | string = 0; // 分
  var hour: number | string = 0; // 小时
  //小时 total_second / 3600
  hour = Math.floor(total_second / 3600);
  //分钟 (total_second - 3600*hour) / 60
  min = Math.floor((total_second - 3600 * hour) / 60);
  //秒 total_second -3600*hour - 60*min
  second = (total_second - 3600 * hour) % 60;

  // console.log(hour, min, second);
  if (hour.toString().length == 1) {
    hour = '0' + hour;
  }
  if (min.toString().length == 1) {
    min = '0' + min;
  }
  if (second.toString().length == 1) {
    second = '0' + second;
  }
  // var result = "" + Number(theTime) + "秒";
  return hour + ':' + min + ':' + second;
};

export default formatSeconds;
